1. Field of the Invention
The present invention relates to a communication system, and more particularly, to a method and apparatus for forwarding packets.
2. Description of the Related Art
Before transmitting a packet by an access point (AP), the media access control (MAC) layer of a wireless local area network (WLAN) needs to wait for a distribution coordination function interframe space (DIFS) and a random backoff time when using a WLAN carrier sense multiple access/collision avoidance (CSMA/CA) method. FIG. 1 shows a frame forwarding diagram, wherein a first frame and a second frame each includes one packet. If there are two packets to be transmitted, two DIFSs and two backoff times have to be employed. In order to increase the forwarding efficiency for a WLAN, the first frame with one packet and the second frame with the other packet can be aggregated with a frame aggregation method. FIG. 2 shows an aggregated frame forwarding diagram. It is shown that one DIFS and one backoff time are used. However, the efficiency of a frame aggregation method relies on the time when the AP receives the packets. If the time spent receiving each packet is excessive, the probability of successful frame aggregations and the forwarding efficiency in the WLAN are decreased.
FIG. 3 shows a diagram illustrating a bridge connecting a plurality of interfaces. In a communication system with the same communication protocol, packets sent from an interface 302 are forwarded to other interfaces 303-304 via a bridge 301.
FIG. 4 shows a sequence for forwarding a packet. The destination interface in FIG. 4 is the interface of an AP.
FIG. 5 shows a conventional flowchart for forwarding packets. At step S501, a packet is forwarded from a source interface. When the packet is received by a bridge, the bridge compares the destination address of the packet with addresses stored in the forwarding table of the bridge at step S502. If the destination address of the packet matches an address stored in the forwarding table, the packet is forwarded to a destination interface. At step S503, the packet is received by the destination interface. At step S504, the buffer of an AP is checked to find a preceding packet. At step S505, if the preceding packet exists in the buffer, the packet and the preceding packet are aggregated into an aggregated frame. At step S506, the aggregated frame is forwarded through the AP. If the preceding packet does not exist, the packet is temporarily stored in the buffer at step S507. At step S508, a waiting time is set for waiting for the next packet. If the waiting time expires, the packet is forwarded directly through the AP without aggregation.
The packet forwarding method described above needs a bridge to forward a packet to another interface. However, if a central processing unit (CPU) has a comparatively low processing speed or if the CPU resources are used for physical layers by priority, packet forwarding tasks might be procrastinated. Further, frame aggregation tasks of an AP and the efficiency of WLAN communication can also be affected. Therefore, an efficient method for forwarding packets is needed for the market to accelerate packet forwarding speed and to increase the frame aggregation efficiency of APs.